import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
    //数据
    state: {
        isLogin: false,
        indexPage: 1,
        selectChannel: 1,
        userInf: {
            name: "zhangsan",
            age: 12
        },
        userName: null,
        userVideo: null,
        userInfo1: null,
    },
    //无异步
    mutations: {
        changeIsLogin(state,payload) {
            state.isLogin = payload.isLogin1
        },
        changeIndex(state,payload) {
            state.indexPage = payload.indexPage
        },
        changeChannel(state,payload) {
            state.selectChannel = payload.selectChannel
        },
        modifyUserInfo(state,payload) {
            state.userInfo1 = payload.userInfo1
        },
        modifyUserName(state,payload) {
            state.userName = payload.userName
        },
        modifyUserVideo(state,payload) {
            state.userVideo = payload.userVideo
        },

    },


    actions: {},
    modules: {},
    plugins: [createPersistedState()]
})
